package com.timmy.google_play.protocol;

import android.support.annotation.NonNull;

import com.timmy.google_play.base.BaseProtocol;
import com.timmy.google_play.bean.ItemBean;

import java.util.Map;

/**
 * Created by Timmy on 2016/12/14.
 */
public class DetailProtocol extends BaseProtocol<ItemBean> {


    private String mPackageName;

    public DetailProtocol(String packageName) {
        mPackageName = packageName;
    }

    public void setPackageName(String packageName) {
        mPackageName = packageName;
    }

    @NonNull
    @Override
    protected String getInterfaceKey() {
        return "detail";
    }

//    @Override
//    protected ItemBean parseData(String body, Gson gson) {
//        return gson.fromJson(body, ItemBean.class);
//    }

    @Override
    protected void initParamsMapData(Map<String, Object> map) {
        map.put("packageName", mPackageName);
    }

    /**
     * 重写生成缓存的key
     */
    @NonNull
    @Override
    protected String generateCachekey(int index) {

        return getInterfaceKey() + "." + mPackageName;
    }
}
